package scene.composants.liaisons;

import java.awt.*;

import UML.Lien;

import scene.composants.IDessinableManipulable;
import scene.composants.elements.Losange;
import yaut.ENV;


/**
 * Liaison entre deux composants qui represente la notion d'agregation entre deux classes
 * 
 * @author Delmas Gabriel
 */
public class RepresentationAgregation extends RepresentationLien
{
	private static final long serialVersionUID = -7370118831428501367L;
	private boolean association;
	private Losange losange;
	private Lien agregationModel;

	public RepresentationAgregation(IDessinableManipulable cPrincipale, IDessinableManipulable cUtilise)
	{
		super(cPrincipale, cUtilise);
		association=false;
	}
	public void setAssociation(boolean type){this.association=type;}
	public boolean getAssociation(){return this.association;}
	
	public void CalculGraphique()
	{
		super.CalculGraphique();
		losange = new Losange(this.pPositionSymbole, association);
	}
	
	public void dessinerSymbole(Graphics2D g2d)
	{
		losange.calculerAngle((double)this.lien.getPDestination().x, (double)this.lien.getPDestination().y, (double)this.lien.getPSource().x, (double)this.lien.getPSource().y);
		losange.dessiner(g2d);
	}
	public void ajouterModel(Lien heritageModel)
	{
		this.agregationModel= heritageModel;
	}
	public Lien getModel(){return this.agregationModel;}
	
	
	public void actionDoubleClique()
	{
		
	}
	public void actionMenuContextuel(Point p)
	{
		ENV.FRAME.getControleur().afficherMenuContextuel(this, p);
	}	
}
